﻿#建议保存编码为：bom头 + utf8

param
(
	[parameter(Mandatory = $true)]
	[ValidateNotNullOrEmpty()]
	[Alias("cname")][String]$cluster名
)

if (Test-Path -LiteralPath "${PSScriptRoot}/${cluster名}/_eds3_bak.json")
{
	Remove-Item "${PSScriptRoot}/${cluster名}/_eds3_bak.json"
}

if (Test-Path -LiteralPath "${PSScriptRoot}/${cluster名}/_eds2_bak.json")
{
	Move-Item -LiteralPath "${PSScriptRoot}/${cluster名}/_eds2_bak.json" -Destination "${PSScriptRoot}/${cluster名}/_eds3_bak.json"
}

if (Test-Path -LiteralPath "${PSScriptRoot}/${cluster名}/_eds1_bak.json")
{
	Move-Item -LiteralPath "${PSScriptRoot}/${cluster名}/_eds1_bak.json" -Destination "${PSScriptRoot}/${cluster名}/_eds2_bak.json"
}

Copy-Item -LiteralPath "${PSScriptRoot}/${cluster名}/eds.json" -Destination "${PSScriptRoot}/${cluster名}/_eds1_bak.json"

& "${PSScriptRoot}/Write-Host2.ps1"  -ForegroundColor Green '信息：备份eds成功'
exit 0
